/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.cspimp.esrz.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseCspImpEntity;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://docs.auauz.net
* @description /
* @author 黄星星
* @date 2020-06-26
**/
@Entity
@Data
@Table(name="esrz_jha_item")
public class JhaItem extends BaseCspImpEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "主键")
    private Long id;

    @Column(name = "cid")
    @ApiModelProperty(value = "所属公司")
    private Long cid;

    @Column(name = "pid")
    @ApiModelProperty(value = "所属项目")
    private Long pid;

    @Column(name = "item_name")
    @ApiModelProperty(value = "名称")
    private String itemName;

    @Column(name = "hazard_or_potential_event")
    @ApiModelProperty(value = "危害或者潜在事件")
    private String hazardOrPotentialEvent;

    @Column(name = "main_consequences_deviations")
    @ApiModelProperty(value = "产生偏差的主要后果")
    private String mainConsequencesDeviations;

    @Column(name = "existing_safety_control_measures")
    @ApiModelProperty(value = "现有安全控制措施")
    private String existingSafetyControlMeasures;

    @Column(name = "control_measures")
    @ApiModelProperty(value = "建议改正/控制措施")
    private String controlMeasures;

    @Column(name = "analytical_method")
    @ApiModelProperty(value = "分析方法")
    private String analyticalMethod;

    @Column(name = "item_happen_id")
    @ApiModelProperty(value = "事件发生可能性主键")
    private Long itemHappenId;

    @Column(name = "item_happen_name")
    @ApiModelProperty(value = "事件发生可能性名称")
    private String itemHappenName;

    @Column(name = "item_e_id")
    @ApiModelProperty(value = "暴露于危险环境的频繁程度主键")
    private Long itemEId;

    @Column(name = "item_e_name")
    @ApiModelProperty(value = "暴露于危险环境的频繁程度名称")
    private String itemEName;

    @Column(name = "item_c_id")
    @ApiModelProperty(value = "发生事故事件偏差产生的后果严重性主键")
    private Long itemCId;

    @Column(name = "item_c_name")
    @ApiModelProperty(value = "发生事故事件偏差产生的后果严重性名称")
    private String itemCName;

    @Column(name = "item_r")
    @ApiModelProperty(value = "R（风险值=L*E*C")
    private String itemR;

    @Column(name = "item_risk_id")
    @ApiModelProperty(value = "风险等级主键")
    private Long itemRiskId;

    @Column(name = "item_risk_code")
    @ApiModelProperty(value = "风险等级code")
    private String itemRiskCode;

    @Column(name = "item_risk_name")
    @ApiModelProperty(value = "风险等级名称")
    private String itemRiskName;

    public void copy(JhaItem source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}